From: Matthieu Gallien Date: Wed, 19 Mar 2025 16:44:51 +0000 (+0100) Subject: define content length header with bulk upload requests X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2^2~37^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=c74765a93134a4ce0f179ba1ebc1424879df7a38;p=nextcloud-desktop.git define content length header with bulk upload requests Signed-off-by: Matthieu Gallien --- diff --git a/src/libsync/putmultifilejob.cpp b/src/libsync/putmultifilejob.cpp index 9b26f56af..99825dd04 100644 --- a/src/libsync/putmultifilejob.cpp +++ b/src/libsync/putmultifilejob.cpp @@ -41,6 +41,8 @@ void PutMultiFileJob::start() { QNetworkRequest req; + auto fullSize = 0; + for(const auto &oneDevice : _devices) { // Our rate limits in UploadDevice::readData will cause an application freeze if used here. // QHttpMultiPart's internal QHttpMultiPartIODevice::readData will loop over and over trying @@ -51,6 +53,7 @@ void PutMultiFileJob::start() auto onePart = QHttpPart{}; + fullSize += oneDevice._device->size(); if (oneDevice._device->size() == 0) { onePart.setBody({}); } else { @@ -72,6 +75,8 @@ void PutMultiFileJob::start() } req.setAttribute(QNetworkRequest::DoNotBufferUploadDataAttribute, true); + req.setHeader(QNetworkRequest::ContentLengthHeader, fullSize); + sendRequest("POST", _url, req, &_body); if (reply()->error() != QNetworkReply::NoError) {